package com.itboye.zhujia.myzhujia;

import java.util.ArrayList;
import java.util.List;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.zhujia.R;
import com.itboye.zhujia.adapter.ZhuJiaWuYeAdapter;
import com.itboye.zhujia.base.BaseActivity;
import com.itboye.zhujia.custom.XGridView;

public class ActivityRepair extends BaseActivity {
	TextView add_shap_title_tv;
	XGridView gridView;
	ImageView close_icon;
	List<String> list = new ArrayList<>();
	List<Integer> list2 = new ArrayList<>();
	String[] strings = { "紧急维修", "居家维修", "家电维修" };
	int[] imgs = { R.drawable.app_loading1, R.drawable.app_loading0,
			R.drawable.app_loading1 };

	@Override
	public int initView() {
		// TODO Auto-generated method stub
		return R.layout.activity_repair;
	}

	@Override
	public void onMyCreate() {
		// TODO Auto-generated method stub
		setContentView(R.layout.activity_repair);
		add_shap_title_tv.setText("选择保修类型");
		close_icon.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		for (int i = 0; i < strings.length; i++) {
			list.add(strings[i] + "");
			list2.add(imgs[i]);
		}
		gridView.setAdapter(new ZhuJiaWuYeAdapter(ActivityRepair.this, list2,
				list, R.layout.item_service));
		gridView.setOnItemClickListener(new OnItemClickListener() {
			Intent intent;

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				if (arg2 == 0) {
					intent = new Intent(ActivityRepair.this,
							ActivityRepairAppointment.class);
				} else if (arg2 == 1) {
					intent = new Intent(ActivityRepair.this,
							ActivityHomeRepair.class);
				} else if (arg2 == 2) {
					intent = new Intent(ActivityRepair.this,
							ActivityRepairAppliances.class);
				}
				startActivity(intent);
			}
		});
	}

}
